<?php

class Vakantiebemiddeling_LoginController extends Vakantiebemiddeling_Controller_Action
{

    public function indexAction()
    {

    }
    public function loginAction() {
    	if ($this->_getParam('username') != 'vakanz' || $this->_getParam('password') != 'bemiddel') {
    		$this->view->errorMsg = 'Gebruikersnaam en/of wachtwoord zijn onjuist.';
    		$this->_forward('index','login',$this->getRequest()->getModuleName());
    	} else {
			$login = new Zend_Session_Namespace(ucfirst($this->getRequest()->getModuleName()).'_Login');
			$login->loginStatus = 4;
			if (!empty($login->lastpage_visited)) {
				$this->_redirect($login->lastpage_visited);
			} else {
				$this->_redirect('/'.$this->getRequest()->getModuleName());
			}
    	}

    }
    public function logoutAction() {
    	$login = new Zend_Session_Namespace($this->getRequest()->getModuleName().'_Login');
    	foreach ($login as $key => $property) {
    		if ($propery != 'lastpage_visited') {
    			unset($crm->{$key});
    		}
    	}
    	$this->_redirect('/'.$this->getRequest()->getModuleName().'/login');
    }
}
